﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:System="clr-namespace:System;assembly=mscorlib"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:dvp="clr-namespace:System.Windows.Controls.DataVisualization.Charting.Primitives;assembly=System.Windows.Controls.DataVisualization.Toolkit"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    xmlns:prim="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Input.Toolkit"
                    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
                    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
                    mc:Ignorable="d">

    <!--  Global Settings.  -->
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Brushes.xaml" />
        <ResourceDictionary Source="Fonts.xaml" />
        <ResourceDictionary Source="CoreStyles.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <!--
        ***************************************************************************
        Expander
        ***************************************************************************
    -->

    <Style TargetType="toolkit:Expander">
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Foreground" Value="{StaticResource HeaderForegroundBrush}" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="TextOptions.TextHintingMode" Value="Animated" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="toolkit:Expander">
                    <Grid Background="Transparent">
                        <Grid.Resources>
                            <ControlTemplate x:Key="ExpanderDownHeaderTemplate" TargetType="ToggleButton">
                                <Grid Background="Transparent">
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CheckStates">
                                            <VisualStateGroup.Transitions>
                                                <VisualTransition GeneratedDuration="00:00:00" />
                                            </VisualStateGroup.Transitions>
                                            <VisualState x:Name="Checked">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="arrow"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Width)"
                                                                     To="8"
                                                                     d:IsOptimized="True" />
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="arrow"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Height)"
                                                                     To="5"
                                                                     d:IsOptimized="True" />
                                                    <ObjectAnimationUsingKeyFrames Duration="0"
                                                                                   Storyboard.TargetName="arrow"
                                                                                   Storyboard.TargetProperty="Data">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="M0,0 L1,0 L0.5,1 z" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Duration="0"
                                                                                   Storyboard.TargetName="arrow"
                                                                                   Storyboard.TargetProperty="Margin">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="0,2,0,0" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Unchecked" />
                                        </VisualStateGroup>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualStateGroup.Transitions>
                                                <VisualTransition GeneratedDuration="0" />
                                                <VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver" />
                                                <VisualTransition GeneratedDuration="00:00:00.1" To="Pressed" />
                                            </VisualStateGroup.Transitions>
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="MouseOver">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="MouseOverElement"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                                     To="1" />
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Pressed" />
                                        </VisualStateGroup>
                                        <VisualStateGroup x:Name="FocusStates">
                                            <VisualState x:Name="Focused">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="FocusVisualElement"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                                     To="1" />
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Unfocused" />
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <StackPanel Orientation="Horizontal">
                                        <Grid Width="18"
                                              Height="18"
                                              Effect="{StaticResource ControlShadowEffect}">
                                            <Ellipse x:Name="circle" Fill="{StaticResource ControlBackgroundNormal}" />
                                            <Ellipse x:Name="MouseOverElement"
                                                     Fill="{StaticResource ControlBackgroundOver}"
                                                     Opacity="0" />
                                            <Path x:Name="arrow"
                                                  Width="5"
                                                  Height="8"
                                                  Data="M0,0 L1,0.5 0,1Z"
                                                  Fill="#404040"
                                                  Stretch="Fill" />
                                        </Grid>
                                        <ContentControl x:Name="header"
                                                        Grid.Row="1"
                                                        Margin="6,0,0,0"
                                                        VerticalAlignment="Center"
                                                        Content="{TemplateBinding Content}"
                                                        ContentTemplate="{TemplateBinding ContentTemplate}"
                                                        Effect="{StaticResource HeaderTextEffect}"
                                                        FontWeight="Bold"
                                                        Foreground="{TemplateBinding Foreground}" />
                                    </StackPanel>
                                    <Rectangle x:Name="FocusVisualElement"
                                               Margin="-2"
                                               IsHitTestVisible="False"
                                               Opacity="0"
                                               RadiusX="2"
                                               RadiusY="2"
                                               Stroke="{StaticResource FocusVisualBrush}"
                                               StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                                </Grid>
                            </ControlTemplate>
                            <ControlTemplate x:Key="ExpanderUpHeaderTemplate" TargetType="ToggleButton">
                                <Grid Background="Transparent">
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CheckStates">
                                            <VisualStateGroup.Transitions>
                                                <VisualTransition GeneratedDuration="00:00:00" />
                                            </VisualStateGroup.Transitions>
                                            <VisualState x:Name="Checked">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="arrow"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Width)"
                                                                     To="8"
                                                                     d:IsOptimized="True" />
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="arrow"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Height)"
                                                                     To="5"
                                                                     d:IsOptimized="True" />
                                                    <ObjectAnimationUsingKeyFrames Duration="0"
                                                                                   Storyboard.TargetName="arrow"
                                                                                   Storyboard.TargetProperty="Data">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="M0,1 L1,1 L0.5,0 z" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Duration="0"
                                                                                   Storyboard.TargetName="arrow"
                                                                                   Storyboard.TargetProperty="Margin">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="0,0,0,2" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Unchecked" />
                                        </VisualStateGroup>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualStateGroup.Transitions>
                                                <VisualTransition GeneratedDuration="0" />
                                                <VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver" />
                                                <VisualTransition GeneratedDuration="00:00:00.1" To="Pressed" />
                                            </VisualStateGroup.Transitions>
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="MouseOver">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="MouseOverElement"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                                     To="1" />
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Pressed" />
                                        </VisualStateGroup>
                                        <VisualStateGroup x:Name="FocusStates">
                                            <VisualState x:Name="Focused" />
                                            <VisualState x:Name="Unfocused" />
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <StackPanel Orientation="Horizontal">
                                        <Grid Width="18"
                                              Height="18"
                                              Effect="{StaticResource ControlShadowEffect}">
                                            <Ellipse x:Name="circle" Fill="{StaticResource ControlBackgroundNormal}" />
                                            <Ellipse x:Name="MouseOverElement"
                                                     Fill="{StaticResource ControlBackgroundOver}"
                                                     Opacity="0" />
                                            <Path x:Name="arrow"
                                                  Width="5"
                                                  Height="8"
                                                  Data="M0,0 L1,0.5 0,1Z"
                                                  Fill="#404040"
                                                  Stretch="Fill" />
                                        </Grid>
                                        <ContentControl x:Name="header"
                                                        Grid.Row="1"
                                                        Margin="6,0,0,0"
                                                        VerticalAlignment="Center"
                                                        Content="{TemplateBinding Content}"
                                                        ContentTemplate="{TemplateBinding ContentTemplate}"
                                                        Effect="{StaticResource HeaderTextEffect}"
                                                        FontWeight="Bold"
                                                        Foreground="{TemplateBinding Foreground}" />
                                    </StackPanel>
                                </Grid>
                            </ControlTemplate>
                            <ControlTemplate x:Key="ExpanderLeftHeaderTemplate" TargetType="ToggleButton">
                                <Grid Background="Transparent">
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CheckStates">
                                            <VisualStateGroup.Transitions>
                                                <VisualTransition GeneratedDuration="00:00:00" />
                                            </VisualStateGroup.Transitions>
                                            <VisualState x:Name="Checked">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="arrow"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Width)"
                                                                     To="5"
                                                                     d:IsOptimized="True" />
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="arrow"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Height)"
                                                                     To="8"
                                                                     d:IsOptimized="True" />
                                                    <ObjectAnimationUsingKeyFrames Duration="0"
                                                                                   Storyboard.TargetName="arrow"
                                                                                   Storyboard.TargetProperty="Data">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="M1,0 L1,1 L0,0.5 z" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Duration="0"
                                                                                   Storyboard.TargetName="arrow"
                                                                                   Storyboard.TargetProperty="Margin">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="0,0,2,0" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Unchecked" />
                                        </VisualStateGroup>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualStateGroup.Transitions>
                                                <VisualTransition GeneratedDuration="0" />
                                                <VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver" />
                                                <VisualTransition GeneratedDuration="00:00:00.1" To="Pressed" />
                                            </VisualStateGroup.Transitions>
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="MouseOver">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="MouseOverElement"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                                     To="1" />
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Pressed" />
                                        </VisualStateGroup>
                                        <VisualStateGroup x:Name="FocusStates">
                                            <VisualState x:Name="Focused" />
                                            <VisualState x:Name="Unfocused" />
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <StackPanel Orientation="Horizontal">
                                        <Grid Width="18"
                                              Height="18"
                                              Effect="{StaticResource ControlShadowEffect}">
                                            <Ellipse x:Name="circle" Fill="{StaticResource ControlBackgroundNormal}" />
                                            <Ellipse x:Name="MouseOverElement"
                                                     Fill="{StaticResource ControlBackgroundOver}"
                                                     Opacity="0" />
                                            <Path x:Name="arrow"
                                                  Width="5"
                                                  Height="8"
                                                  Data="M0,0 L1,0.5 0,1Z"
                                                  Fill="#404040"
                                                  Stretch="Fill" />
                                        </Grid>
                                        <ContentControl x:Name="header"
                                                        Grid.Row="1"
                                                        Margin="6,0,0,0"
                                                        VerticalAlignment="Center"
                                                        Content="{TemplateBinding Content}"
                                                        ContentTemplate="{TemplateBinding ContentTemplate}"
                                                        Effect="{StaticResource HeaderTextEffect}"
                                                        FontWeight="Bold"
                                                        Foreground="{TemplateBinding Foreground}" />
                                    </StackPanel>
                                </Grid>
                            </ControlTemplate>
                            <ControlTemplate x:Key="ExpanderRightHeaderTemplate" TargetType="ToggleButton">
                                <Grid Background="Transparent">
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CheckStates">
                                            <VisualStateGroup.Transitions>
                                                <VisualTransition GeneratedDuration="00:00:00" />
                                            </VisualStateGroup.Transitions>
                                            <VisualState x:Name="Checked">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="arrow"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Width)"
                                                                     To="5"
                                                                     d:IsOptimized="True" />
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="arrow"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Height)"
                                                                     To="8"
                                                                     d:IsOptimized="True" />
                                                    <ObjectAnimationUsingKeyFrames Duration="0"
                                                                                   Storyboard.TargetName="arrow"
                                                                                   Storyboard.TargetProperty="Data">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="M1,0 L1,1 L0,0.5 z" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Duration="0"
                                                                                   Storyboard.TargetName="arrow"
                                                                                   Storyboard.TargetProperty="Margin">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="0,0,2,0" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Unchecked" />
                                        </VisualStateGroup>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualStateGroup.Transitions>
                                                <VisualTransition GeneratedDuration="0" />
                                                <VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver" />
                                                <VisualTransition GeneratedDuration="00:00:00.1" To="Pressed" />
                                            </VisualStateGroup.Transitions>
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="MouseOver">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="MouseOverElement"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                                     To="1" />
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Pressed" />
                                        </VisualStateGroup>
                                        <VisualStateGroup x:Name="FocusStates">
                                            <VisualState x:Name="Focused" />
                                            <VisualState x:Name="Unfocused" />
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <StackPanel Orientation="Horizontal">
                                        <Grid Width="18"
                                              Height="18"
                                              Effect="{StaticResource ControlShadowEffect}">
                                            <Ellipse x:Name="circle" Fill="{StaticResource ControlBackgroundNormal}" />
                                            <Ellipse x:Name="MouseOverElement"
                                                     Fill="{StaticResource ControlBackgroundOver}"
                                                     Opacity="0" />
                                            <Path x:Name="arrow"
                                                  Width="5"
                                                  Height="8"
                                                  Data="M0,0 L1,0.5 0,1Z"
                                                  Fill="#404040"
                                                  Stretch="Fill" />
                                        </Grid>
                                        <ContentControl x:Name="header"
                                                        Grid.Row="1"
                                                        Margin="6,0,0,0"
                                                        VerticalAlignment="Center"
                                                        Content="{TemplateBinding Content}"
                                                        ContentTemplate="{TemplateBinding ContentTemplate}"
                                                        Effect="{StaticResource HeaderTextEffect}"
                                                        FontWeight="Bold"
                                                        Foreground="{TemplateBinding Foreground}" />
                                    </StackPanel>
                                </Grid>
                            </ControlTemplate>
                        </Grid.Resources>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="Background"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="0.55" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused" />
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ExpansionStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Collapsed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="ExpandSite"
                                                                       Storyboard.TargetProperty="(ExpandableContentControl.Percentage)">
                                            <SplineDoubleKeyFrame KeySpline="0.2,0,0,1"
                                                                  KeyTime="00:00:00.3"
                                                                  Value="0" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00.3"
                                                                       Duration="00:00:00"
                                                                       Storyboard.TargetName="ExpandSite"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Collapsed" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Expanded">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="ExpandSite"
                                                                       Storyboard.TargetProperty="(ExpandableContentControl.Percentage)">
                                            <SplineDoubleKeyFrame KeySpline="0.2,0,0,1"
                                                                  KeyTime="00:00:00.3"
                                                                  Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ExpandDirectionStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="ExpandDown">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="rd1"
                                                                       Storyboard.TargetProperty="Height">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="cd0"
                                                                       Storyboard.TargetProperty="Width">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ExpandUp">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="ExpanderButton"
                                                                       Storyboard.TargetProperty="Template">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ExpanderUpHeaderTemplate}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="ExpanderButton"
                                                                       Storyboard.TargetProperty="(Grid.Row)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="1" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="ExpandSite"
                                                                       Storyboard.TargetProperty="(Grid.Row)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="0" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="rd0"
                                                                       Storyboard.TargetProperty="Height">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="cd0"
                                                                       Storyboard.TargetProperty="Width">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="ExpandSite"
                                                                       Storyboard.TargetProperty="Margin">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="0,0,0,6" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ExpandLeft">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="ExpanderButton"
                                                                       Storyboard.TargetProperty="Template">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ExpanderLeftHeaderTemplate}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="ExpanderButton"
                                                                       Storyboard.TargetProperty="(Grid.Column)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="1" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="ExpandSite"
                                                                       Storyboard.TargetProperty="(Grid.Row)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="0" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="rd0"
                                                                       Storyboard.TargetProperty="Height">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="cd0"
                                                                       Storyboard.TargetProperty="Width">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="ExpandSite"
                                                                       Storyboard.TargetProperty="Margin">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="0,0,6,0" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ExpandRight">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpanderButton" Storyboard.TargetProperty="Template">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ExpanderRightHeaderTemplate}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="ExpandSite"
                                                                       Storyboard.TargetProperty="(Grid.Row)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="0" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="ExpandSite"
                                                                       Storyboard.TargetProperty="(Grid.Column)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="1" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="rd0"
                                                                       Storyboard.TargetProperty="Height">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="cd1"
                                                                       Storyboard.TargetProperty="Width">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="ExpandSite"
                                                                       Storyboard.TargetProperty="Margin">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="6,0,0,0" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Background"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="3">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition x:Name="cd0" Width="Auto" />
                                    <ColumnDefinition x:Name="cd1" Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition x:Name="rd0" Height="Auto" />
                                    <RowDefinition x:Name="rd1" Height="Auto" />
                                </Grid.RowDefinitions>
                                <ToggleButton x:Name="ExpanderButton"
                                              Grid.Row="0"
                                              Grid.Column="0"
                                              MinWidth="0"
                                              MinHeight="0"
                                              Margin="1"
                                              HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                              Content="{TemplateBinding Header}"
                                              ContentTemplate="{TemplateBinding HeaderTemplate}"
                                              FontFamily="{TemplateBinding FontFamily}"
                                              FontSize="{TemplateBinding FontSize}"
                                              FontStretch="{TemplateBinding FontStretch}"
                                              FontStyle="{TemplateBinding FontStyle}"
                                              FontWeight="{TemplateBinding FontWeight}"
                                              Foreground="{TemplateBinding Foreground}"
                                              IsChecked="{TemplateBinding IsExpanded}"
                                              Padding="{TemplateBinding Padding}"
                                              Template="{StaticResource ExpanderDownHeaderTemplate}" />
                                <toolkit:ExpandableContentControl x:Name="ExpandSite"
                                                                  Grid.Row="1"
                                                                  Margin="0,6,0,0"
                                                                  HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                                  VerticalAlignment="{TemplateBinding VerticalAlignment}"
                                                                  HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                                  VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                                                  Content="{TemplateBinding Content}"
                                                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                                                  FontFamily="{TemplateBinding FontFamily}"
                                                                  FontSize="{TemplateBinding FontSize}"
                                                                  FontStretch="{TemplateBinding FontStretch}"
                                                                  FontStyle="{TemplateBinding FontStyle}"
                                                                  FontWeight="{TemplateBinding FontWeight}"
                                                                  Foreground="{TemplateBinding Foreground}"
                                                                  IsTabStop="False"
                                                                  Percentage="0"
                                                                  RevealMode="{TemplateBinding ExpandDirection}" />
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        SpinnerStyle (used by the different *UpDown control styles)
        ***************************************************************************
    -->

    <Style x:Key="SpinnerStyle" TargetType="toolkit:ButtonSpinner">
        <Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Padding" Value="5,4,5,4" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="toolkit:ButtonSpinner">
                    <Grid d:DesignWidth="100">
                        <Grid.Resources>
                            <ControlTemplate x:Key="UpDownButton" TargetType="RepeatButton">
                                <Grid Background="Transparent">
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualStateGroup.Transitions>
                                                <VisualTransition GeneratedDuration="0" />
                                            </VisualStateGroup.Transitions>
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="MouseOver" />
                                            <VisualState x:Name="Pressed">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="PressedBorder"
                                                                     Storyboard.TargetProperty="Opacity"
                                                                     To="1.0" />
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="ContentHost"
                                                                     Storyboard.TargetProperty="Opacity"
                                                                     To="0.5" />
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <Border x:Name="PressedBorder"
                                            Background="#2000"
                                            Opacity="0" />
                                    <ContentPresenter x:Name="ContentHost" />
                                </Grid>
                            </ControlTemplate>
                        </Grid.Resources>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="00:00:00.1"
                                                         Storyboard.TargetName="MouseOverBackground"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1.0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="presentationSite"
                                                                       Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource DisabledBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="ElementContainer"
                                                                       Storyboard.TargetProperty="BorderBrush">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource DisabledBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="00:00:00.1"
                                                         Storyboard.TargetName="MouseOverBackground"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1.0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="IncreaseStates">
                                <VisualState x:Name="IncreaseEnabled" />
                                <VisualState x:Name="IncreaseDisabled" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="DecreaseStates">
                                <VisualState x:Name="DecreaseEnabled" />
                                <VisualState x:Name="DecreaseDisabled" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="ElementContainer"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="2.5"
                                Opacity="1">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="24" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>
                                <ContentControl x:Name="presentationSite"
                                                Grid.RowSpan="2"
                                                Margin="1"
                                                HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                                Content="{TemplateBinding Content}"
                                                IsTabStop="False" />
                                <Button Grid.Row="0"
                                        Grid.RowSpan="2"
                                        Grid.Column="1"
                                        IsHitTestVisible="True"
                                        IsTabStop="False">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Grid Background="Transparent" />
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                                <Border x:Name="MouseOverBackground"
                                        Grid.RowSpan="2"
                                        Grid.Column="1"
                                        Background="#1000"
                                        CornerRadius="0,3,2,0"
                                        IsHitTestVisible="False"
                                        Opacity="0">
                                    <StackPanel Height="2"
                                                Margin="0,0,0,0"
                                                VerticalAlignment="Center">
                                        <Rectangle Height="1" Fill="#2000" />
                                        <Rectangle Height="1" Fill="#EFFF" />
                                    </StackPanel>
                                </Border>
                                <RepeatButton x:Name="IncreaseButton"
                                              Grid.Row="0"
                                              Grid.Column="1"
                                              ClickMode="Press"
                                              IsTabStop="False"
                                              Template="{StaticResource UpDownButton}">
                                    <Path Width="7"
                                          Height="4"
                                          Margin="0,1,0,0"
                                          HorizontalAlignment="Center"
                                          VerticalAlignment="Center"
                                          Data="M0,1 L1,1 0.5,0Z"
                                          Fill="#404040"
                                          Stretch="Fill" />
                                </RepeatButton>
                                <RepeatButton x:Name="DecreaseButton"
                                              Grid.Row="1"
                                              Grid.Column="1"
                                              ClickMode="Press"
                                              IsTabStop="False"
                                              Template="{StaticResource UpDownButton}">
                                    <Path Width="7"
                                          Height="4"
                                          Margin="0,0,0,0"
                                          HorizontalAlignment="Center"
                                          VerticalAlignment="Center"
                                          Data="M0,0 L1,0 0.5,1Z"
                                          Fill="#404040"
                                          Stretch="Fill" />
                                </RepeatButton>
                            </Grid>
                        </Border>
                        <Border x:Name="OuterHighlight"
                                Margin="0,0,-1,-1"
                                BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                                BorderThickness="0,0,1,1"
                                CornerRadius="3" />
                        <Border x:Name="InnerShadowDark"
                                Margin="1"
                                BorderBrush="{StaticResource InnerShadowDarkBrush}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="2" />
                        <Border x:Name="InnerShadowLight"
                                Margin="2"
                                BorderBrush="{StaticResource InnerShadowLightBrush}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="1" />
                        <Border x:Name="DisabledVisualElement"
                                Margin="1"
                                Background="#50000000"
                                CornerRadius="2"
                                IsHitTestVisible="False"
                                Opacity="0" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        NumericUpDown
        ***************************************************************************
    -->

    <Style TargetType="toolkit:NumericUpDown">
        <Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="SpinnerStyle" Value="{StaticResource SpinnerStyle}" />
        <Setter Property="Foreground" Value="{StaticResource InputForegroundBrush}" />
        <Setter Property="Height" Value="Auto" />
        <Setter Property="Padding" Value="5,4,5,4" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="toolkit:NumericUpDown">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="DisabledVisualElement"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="0.55" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Pressed" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsOpen">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <toolkit:ButtonSpinner x:Name="Spinner"
                                               MinWidth="35"
                                               HorizontalContentAlignment="Stretch"
                                               VerticalContentAlignment="Stretch"
                                               Style="{TemplateBinding SpinnerStyle}">
                            <TextBox x:Name="Text"
                                     MinWidth="20"
                                     AcceptsReturn="False"
                                     BorderThickness="1"
                                     FontFamily="{TemplateBinding FontFamily}"
                                     FontSize="{TemplateBinding FontSize}"
                                     FontStretch="{TemplateBinding FontStretch}"
                                     FontStyle="{TemplateBinding FontStyle}"
                                     FontWeight="{TemplateBinding FontWeight}"
                                     Foreground="{TemplateBinding Foreground}"
                                     Padding="{TemplateBinding Padding}"
                                     SelectionBackground="{StaticResource InputSelectionBrush}"
                                     Text="{TemplateBinding Value}"
                                     TextAlignment="Left"
                                     TextWrapping="NoWrap">
                                <TextBox.Style>
                                    <Style TargetType="TextBox">
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="TextBox">
                                                    <ScrollViewer x:Name="ContentElement"
                                                                  BorderThickness="0"
                                                                  Padding="{TemplateBinding Padding}" />
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </TextBox.Style>
                            </TextBox>
                        </toolkit:ButtonSpinner>
                        <Border x:Name="DisabledVisualElement"
                                Background="{StaticResource DisabledBrush}"
                                CornerRadius="2"
                                IsHitTestVisible="false"
                                Opacity="0" />
                        <Rectangle x:Name="FocusVisualElement"
                                   Margin="1"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{StaticResource FocusVisualBrush}"
                                   StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                        <Border x:Name="ValidationErrorElement"
                                BorderBrush="{StaticResource ErrorBrush}"
                                BorderThickness="1"
                                CornerRadius="3"
                                Visibility="Collapsed">
                            <ToolTipService.ToolTip>
                                <ToolTip x:Name="validationTooltip"
                                         DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                         Placement="Right"
                                         PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                         Template="{StaticResource ValidationToolTipTemplate}">
                                    <ToolTip.Triggers>
                                        <EventTrigger RoutedEvent="Canvas.Loaded">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="True" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </ToolTip.Triggers>
                                </ToolTip>
                            </ToolTipService.ToolTip>
                            <Grid Width="12"
                                  Height="12"
                                  Margin="1,-4,-4,0"
                                  HorizontalAlignment="Right"
                                  VerticalAlignment="Top"
                                  Background="Transparent">
                                <Path Margin="1,3,0,0"
                                      Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z"
                                      Fill="{StaticResource ErrorBrush}" />
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        DomainUpDown
        ***************************************************************************
    -->

    <Style TargetType="toolkit:DomainUpDown">
        <Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="SpinnerStyle" Value="{StaticResource SpinnerStyle}" />
        <Setter Property="Foreground" Value="{StaticResource InputForegroundBrush}" />
        <Setter Property="Height" Value="Auto" />
        <Setter Property="Padding" Value="5,4,5,4" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="toolkit:DomainUpDown">
                    <Grid x:Name="RootElement">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Pressed" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="DisabledVisualElement"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="0.55" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="InteractionModeStates">
                                <VisualState x:Name="Edit">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="Text"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="Visualization"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Display" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="DomainStates">
                                <VisualState x:Name="ValidDomain" />
                                <VisualState x:Name="InvalidDomain">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="ValidationErrorElement"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <toolkit:ButtonSpinner x:Name="Spinner"
                                               HorizontalAlignment="Stretch"
                                               VerticalAlignment="Stretch"
                                               HorizontalContentAlignment="Stretch"
                                               VerticalContentAlignment="Stretch"
                                               Background="{TemplateBinding Background}"
                                               BorderBrush="{TemplateBinding BorderBrush}"
                                               BorderThickness="{TemplateBinding BorderThickness}"
                                               IsTabStop="False"
                                               Padding="{TemplateBinding Padding}"
                                               Style="{TemplateBinding SpinnerStyle}"
                                               TabIndex="3">
                            <Grid>
                                <ContentControl x:Name="Visualization"
                                                Margin="0"
                                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                Content="{TemplateBinding Value}"
                                                ContentTemplate="{TemplateBinding ItemTemplate}"
                                                FontFamily="{TemplateBinding FontFamily}"
                                                FontSize="{TemplateBinding FontSize}"
                                                FontStretch="{TemplateBinding FontStretch}"
                                                Foreground="{TemplateBinding Foreground}"
                                                IsHitTestVisible="False"
                                                IsTabStop="False"
                                                Opacity="1"
                                                Padding="{TemplateBinding Padding}" />
                                <TextBox x:Name="Text"
                                         Margin="0"
                                         HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                         VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                         AcceptsReturn="False"
                                         Background="Red"
                                         BorderThickness="0"
                                         FontFamily="{TemplateBinding FontFamily}"
                                         FontSize="{TemplateBinding FontSize}"
                                         FontStretch="{TemplateBinding FontStretch}"
                                         Foreground="{TemplateBinding Foreground}"
                                         IsHitTestVisible="False"
                                         IsTabStop="True"
                                         Opacity="0"
                                         Padding="{TemplateBinding Padding}"
                                         SelectionBackground="{StaticResource InputSelectionBrush}"
                                         TextWrapping="NoWrap">
                                    <TextBox.Style>
                                        <Style TargetType="TextBox">
                                            <Setter Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate TargetType="TextBox">
                                                        <ScrollViewer x:Name="ContentElement"
                                                                      BorderThickness="0"
                                                                      Padding="{TemplateBinding Padding}" />
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </TextBox.Style>
                                </TextBox>
                            </Grid>
                        </toolkit:ButtonSpinner>
                        <Border x:Name="DisabledVisualElement"
                                Background="{StaticResource DisabledBrush}"
                                CornerRadius="2"
                                IsHitTestVisible="false"
                                Opacity="0" />
                        <Rectangle x:Name="FocusVisualElement"
                                   Margin="1"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{StaticResource FocusVisualBrush}"
                                   StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                        <Border x:Name="ValidationErrorElement"
                                BorderBrush="{StaticResource ErrorBrush}"
                                BorderThickness="1"
                                CornerRadius="3"
                                Visibility="Collapsed">
                            <ToolTipService.ToolTip>
                                <ToolTip x:Name="validationTooltip"
                                         DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                         Placement="Right"
                                         PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                         Template="{StaticResource ValidationToolTipTemplate}">
                                    <ToolTip.Triggers>
                                        <EventTrigger RoutedEvent="Canvas.Loaded">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="True" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </ToolTip.Triggers>
                                </ToolTip>
                            </ToolTipService.ToolTip>
                            <Grid Width="12"
                                  Height="12"
                                  Margin="1,-4,-4,0"
                                  HorizontalAlignment="Right"
                                  VerticalAlignment="Top"
                                  Background="Transparent">
                                <Path Margin="1,3,0,0"
                                      Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z"
                                      Fill="{StaticResource ErrorBrush}" />
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        TimeUpDown
        ***************************************************************************
    -->

    <Style TargetType="toolkit:TimeUpDown">
        <Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{StaticResource InputForegroundBrush}" />
        <Setter Property="Height" Value="Auto" />
        <Setter Property="Padding" Value="5,4,5,4" />
        <Setter Property="SpinnerStyle" Value="{StaticResource SpinnerStyle}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="toolkit:TimeUpDown">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Pressed" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="DisabledVisualElement"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="0.55" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="TimeHintStates">
                                <VisualState x:Name="TimeHintOpenedUp">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="TimeHintVisualElement"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="TimeHintVisualElement"
                                                                       Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
                                            <SplineDoubleKeyFrame KeySpline="0,0,0,1"
                                                                  KeyTime="00:00:00.200"
                                                                  Value="-23" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="TimeHintVisualElement"
                                                                       Storyboard.TargetProperty="Height">
                                            <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0" />
                                            <SplineDoubleKeyFrame KeySpline="0,0,0,1"
                                                                  KeyTime="00:00:00.200"
                                                                  Value="22" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="TimeHintOpenedDown">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="TimeHintVisualElement"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="TimeHintVisualElement"
                                                                       Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
                                            <SplineDoubleKeyFrame KeySpline="0,0,0,1"
                                                                  KeyTime="00:00:00.200"
                                                                  Value="0" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="TimeHintVisualElement"
                                                                       Storyboard.TargetProperty="Height">
                                            <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0" />
                                            <SplineDoubleKeyFrame KeySpline="0,0,0,1"
                                                                  KeyTime="00:00:00.200"
                                                                  Value="22" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="TimeHintClosed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="TimeHintVisualElement"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:20" Value="Collapsed" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="TimeHintVisualElement"
                                                                       Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
                                            <SplineDoubleKeyFrame KeySpline="0,0,0,1"
                                                                  KeyTime="00:00:00.200"
                                                                  Value="0" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="TimeHintVisualElement"
                                                                       Storyboard.TargetProperty="Height">
                                            <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="22" />
                                            <SplineDoubleKeyFrame KeySpline="0,0,0,1"
                                                                  KeyTime="00:00:00.200"
                                                                  Value="0" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ParsingStates">
                                <VisualState x:Name="ValidTime">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="validicon"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidTime">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="invalidicon"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="EmptyTime">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="emptyicon"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidFocused" />
                                <VisualState x:Name="InvalidUnfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Popup x:Name="TimeHintPopup" VerticalOffset="0">
                            <Border x:Name="TimeHintVisualElement"
                                    HorizontalAlignment="Left"
                                    Background="White"
                                    BorderBrush="Gray"
                                    BorderThickness="1"
                                    IsHitTestVisible="True"
                                    Visibility="Collapsed">
                                <Border.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform />
                                        <SkewTransform />
                                        <RotateTransform />
                                        <TranslateTransform />
                                    </TransformGroup>
                                </Border.RenderTransform>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition Width="Auto" MinWidth="15" />
                                    </Grid.ColumnDefinitions>
                                    <ContentControl Grid.Column="0"
                                                    Margin="3"
                                                    HorizontalAlignment="Right"
                                                    VerticalAlignment="Center"
                                                    Content="{TemplateBinding TimeHintContent}"
                                                    FontSize="10"
                                                    Foreground="#FF4A4A4A"
                                                    IsHitTestVisible="False"
                                                    IsTabStop="False" />
                                    <ContentControl x:Name="emptyicon"
                                                    Grid.Column="1"
                                                    Margin="3"
                                                    IsHitTestVisible="False"
                                                    IsTabStop="False"
                                                    Visibility="Collapsed" />
                                    <ContentControl x:Name="validicon"
                                                    Grid.Column="1"
                                                    Margin="3"
                                                    IsHitTestVisible="False"
                                                    IsTabStop="False"
                                                    Visibility="Collapsed" />
                                    <ContentControl x:Name="invalidicon"
                                                    Grid.Column="1"
                                                    VerticalAlignment="Center"
                                                    IsHitTestVisible="False"
                                                    IsTabStop="False"
                                                    Visibility="Collapsed">
                                        <Grid Width="10"
                                              Height="13"
                                              VerticalAlignment="Bottom">
                                            <Path Height="11.833"
                                                  HorizontalAlignment="Stretch"
                                                  VerticalAlignment="Top"
                                                  Data="F1 M 28.1143,29.4857L 28.1143,27.4286L 20.7612,13.0286L 19.3898,13.0286L 12.3429,27.4286L 12.3429,29.4857L 28.1143,29.4857 Z "
                                                  Stretch="Fill"
                                                  StrokeEndLineCap="Round"
                                                  StrokeLineJoin="Bevel"
                                                  StrokeStartLineCap="Round">
                                                <Path.Fill>
                                                    <LinearGradientBrush StartPoint="1.13883,0.460318" EndPoint="-0.140331,0.460318">
                                                        <GradientStop Offset="0.123636" Color="#FFF7F79F" />
                                                        <GradientStop Offset="0.177662" Color="#FBFBFB7D" />
                                                        <GradientStop Offset="0.24" Color="#F6FFFF5B" />
                                                        <GradientStop Offset="0.52" Color="#E7CAA709" />
                                                        <GradientStop Offset="0.941376" Color="#9ADABE0C" />
                                                        <GradientStop Offset="0.941818" Color="#4DEBD60F" />
                                                        <GradientStop Offset="0.956364" Color="#FBF6EC20" />
                                                        <GradientStop Offset="0.963636" Color="#FFFFFF2F" />
                                                    </LinearGradientBrush>
                                                </Path.Fill>
                                                <Path.Stroke>
                                                    <LinearGradientBrush StartPoint="1.10074,0.462591" EndPoint="-0.102151,0.462591">
                                                        <GradientStop Offset="0.0436364" Color="#F6CAA709" />
                                                        <GradientStop Offset="0.149091" Color="#F3F7F34F" />
                                                        <GradientStop Offset="0.825455" Color="#E7CAA709" />
                                                        <GradientStop Offset="0.967124" Color="#E7967C07" />
                                                        <GradientStop Offset="0.967273" Color="#E7625106" />
                                                    </LinearGradientBrush>
                                                </Path.Stroke>
                                            </Path>
                                            <Path Height="4.683"
                                                  Margin="4.25,2.25,3.75,0"
                                                  VerticalAlignment="Top"
                                                  Data="F1 M 18.6937,17.3004L 22.2563,17.3004L 21.1313,23.6937L 19.8563,23.6937L 18.6937,17.3004 Z "
                                                  Stretch="Fill"
                                                  Stroke="#FF1B1B54"
                                                  StrokeEndLineCap="Round"
                                                  StrokeLineJoin="Bevel"
                                                  StrokeStartLineCap="Round"
                                                  StrokeThickness="0.3">
                                                <Path.Fill>
                                                    <LinearGradientBrush StartPoint="-0.400002,0.50126" EndPoint="1.4,0.50126">
                                                        <GradientStop Offset="0.123636" Color="#FFF7F79F" />
                                                        <GradientStop Offset="0.175974" Color="#FB8F8873" />
                                                        <GradientStop Offset="0.236364" Color="#F6271A47" />
                                                        <GradientStop Offset="0.534545" Color="#E7271A47" />
                                                        <GradientStop Offset="0.941391" Color="#9A89782B" />
                                                        <GradientStop Offset="0.941818" Color="#4DEBD60F" />
                                                        <GradientStop Offset="0.956364" Color="#FBF6EC20" />
                                                        <GradientStop Offset="0.963636" Color="#FFFFFF2F" />
                                                    </LinearGradientBrush>
                                                </Path.Fill>
                                            </Path>
                                            <Path Height="3.11"
                                                  Margin="3.833,0,4.167,0.833"
                                                  VerticalAlignment="Bottom"
                                                  Data="F1 M 20.225,25.122L 20.725,25.122C 21.2773,25.122 21.725,25.5697 21.725,26.122L 21.725,26.872C 21.725,27.4243 21.2773,27.872 20.725,27.872L 20.225,27.872C 19.6727,27.872 19.225,27.4243 19.225,26.872L 19.225,26.122C 19.225,25.5697 19.6727,25.122 20.225,25.122 Z "
                                                  Stretch="Fill"
                                                  Stroke="#FF1C1C50"
                                                  StrokeEndLineCap="Round"
                                                  StrokeLineJoin="Round"
                                                  StrokeStartLineCap="Round"
                                                  StrokeThickness="0.3">
                                                <Path.Fill>
                                                    <LinearGradientBrush StartPoint="-0.0599991,0.5" EndPoint="1.06,0.5">
                                                        <GradientStop Offset="0.236364" Color="#F6271A47" />
                                                        <GradientStop Offset="0.534545" Color="#E7271A47" />
                                                        <GradientStop Offset="0.98135" Color="#9A89782B" />
                                                        <GradientStop Offset="0.981818" Color="#4DEBD60F" />
                                                    </LinearGradientBrush>
                                                </Path.Fill>
                                            </Path>
                                        </Grid>
                                    </ContentControl>
                                </Grid>
                            </Border>
                        </Popup>
                        <toolkit:ButtonSpinner x:Name="Spinner"
                                               MinWidth="35"
                                               HorizontalContentAlignment="Stretch"
                                               VerticalContentAlignment="Stretch"
                                               Style="{TemplateBinding SpinnerStyle}">
                            <TextBox x:Name="Text"
                                     MinWidth="20"
                                     AcceptsReturn="False"
                                     BorderThickness="1"
                                     FontFamily="{TemplateBinding FontFamily}"
                                     FontSize="{TemplateBinding FontSize}"
                                     FontStretch="{TemplateBinding FontStretch}"
                                     FontStyle="{TemplateBinding FontStyle}"
                                     FontWeight="{TemplateBinding FontWeight}"
                                     Foreground="{TemplateBinding Foreground}"
                                     Padding="{TemplateBinding Padding}"
                                     SelectionBackground="{StaticResource InputSelectionBrush}"
                                     Text="{TemplateBinding Value}"
                                     TextAlignment="Left"
                                     TextWrapping="NoWrap">
                                <TextBox.Style>
                                    <Style TargetType="TextBox">
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="TextBox">
                                                    <ScrollViewer x:Name="ContentElement"
                                                                  BorderThickness="0"
                                                                  Padding="{TemplateBinding Padding}" />
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </TextBox.Style>
                            </TextBox>
                        </toolkit:ButtonSpinner>
                        <Rectangle x:Name="FocusVisualElement"
                                   Margin="1"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{StaticResource FocusVisualBrush}"
                                   StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                        <Border x:Name="DisabledVisualElement"
                                Background="{StaticResource DisabledBrush}"
                                CornerRadius="2"
                                IsHitTestVisible="false"
                                Opacity="0" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        Rating (including RatingItem style)
        ***************************************************************************
    -->

    <Style x:Key="RatingItemStyle" TargetType="toolkit:RatingItem">

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="toolkit:RatingItem">
                    <Grid Width="21"
                          Height="20"
                          Background="Transparent">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="20" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="00:00:00.2000000" />
                                    <VisualTransition From="MouseOver"
                                                      GeneratedDuration="00:00:00.2000000"
                                                      To="Normal" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Pressed" />
                                <VisualState x:Name="Disabled" />
                                <VisualState x:Name="ReadOnly" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="00:00:00.1000000" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Focused">
                                    <Storyboard />
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FillStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="00:00:00.1000000" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Empty" />
                                <VisualState x:Name="Partial" />
                                <VisualState x:Name="Filled" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid x:Name="DefaultRatingItem" Margin="2">
                            <Path Data="F1 M 412.75,172.5C 412.66,172.21 412.39,172.01 412.08,172.01L 399.29,172.01L 395.33,159.85C 395.24,159.56 394.97,159.36 394.66,159.36C 394.36,159.36 394.09,159.56 393.99,159.85L 390.01,172.01L 377.24,172.01C 376.94,172.01 376.66,172.21 376.57,172.5C 376.48,172.78 376.58,173.10 376.82,173.28L 387.16,180.81L 383.18,193.04C 383.08,193.33 383.19,193.65 383.43,193.83C 383.68,194.01 384.01,194.01 384.26,193.83L 394.66,186.28L 405.04,193.83C 405.17,193.92 405.31,193.96 405.45,193.96C 405.60,193.96 405.74,193.92 405.87,193.83C 406.12,193.65 406.22,193.33 406.13,193.04L 402.14,180.81L 412.50,173.28C 412.74,173.10 412.85,172.78 412.75,172.5 Z"
                                  Fill="#44000000"
                                  Stretch="Fill" />
                            <Grid Clip="M16.982708,6.0754223 C16.940502,5.9413404 16.813885,5.8488626 16.668489,5.8488626 L10.670356,5.8488626 L8.8132191,0.22655855 C8.7710133,0.092469923 8.6443958,-8.6220638E-07 8.4990158,-8.6220638E-07 C8.3583155,-8.6220638E-07 8.231699,0.092469923 8.1847992,0.22655855 L6.3183017,5.8488626 L0.32952729,5.8488626 C0.18884158,5.8488626 0.057530161,5.9413404 0.015324448,6.0754223 C-0.026881263,6.2048826 0.020004431,6.3528414 0.1325673,6.4360633 L4.98173,9.9176407 L3.1152186,15.572313 C3.0683188,15.706402 3.1199131,15.854354 3.2324617,15.937583 C3.3497045,16.020803 3.504473,16.020803 3.6217158,15.937583 L8.4990158,12.446755 L13.366941,15.937583 C13.42791,15.979194 13.493559,15.997692 13.559221,15.997692 C13.629564,15.997692 13.695213,15.979194 13.756182,15.937583 C13.873425,15.854354 13.920324,15.706402 13.878119,15.572313 L12.006927,9.9176407 L16.865465,6.4360633 C16.978014,6.3528414 17.029608,6.2048826 16.982708,6.0754223 z">
                                <Path Margin="0,1,0,-1"
                                      Data="F1 M 412.75,172.5C 412.66,172.21 412.39,172.01 412.08,172.01L 399.29,172.01L 395.33,159.85C 395.24,159.56 394.97,159.36 394.66,159.36C 394.36,159.36 394.09,159.56 393.99,159.85L 390.01,172.01L 377.24,172.01C 376.94,172.01 376.66,172.21 376.57,172.5C 376.48,172.78 376.58,173.10 376.82,173.28L 387.16,180.81L 383.18,193.04C 383.08,193.33 383.19,193.65 383.43,193.83C 383.68,194.01 384.01,194.01 384.26,193.83L 394.66,186.28L 405.04,193.83C 405.17,193.92 405.31,193.96 405.45,193.96C 405.60,193.96 405.74,193.92 405.87,193.83C 406.12,193.65 406.22,193.33 406.13,193.04L 402.14,180.81L 412.50,173.28C 412.74,173.10 412.85,172.78 412.75,172.5 Z"
                                      Stretch="Fill"
                                      Stroke="#DD000000">
                                    <Path.Effect>
                                        <BlurEffect Radius="2" />
                                    </Path.Effect>
                                </Path>
                            </Grid>
                        </Grid>
                        <prim:LinearClipper x:Name="Clipper"
                                            Margin="{TemplateBinding Padding}"
                                            ExpandDirection="Right"
                                            RatioVisible="{TemplateBinding DisplayValue}">
                            <Path Margin="2"
                                  VerticalAlignment="Stretch"
                                  Data="M16.982708,6.0754223 C16.940502,5.9413404 16.813885,5.8488626 16.668489,5.8488626 L10.670356,5.8488626 L8.8132191,0.22655855 C8.7710133,0.092469923 8.6443958,-8.6220638E-07 8.4990158,-8.6220638E-07 C8.3583155,-8.6220638E-07 8.231699,0.092469923 8.1847992,0.22655855 L6.3183017,5.8488626 L0.32952729,5.8488626 C0.18884158,5.8488626 0.057530161,5.9413404 0.015324448,6.0754223 C-0.026881263,6.2048826 0.020004431,6.3528414 0.1325673,6.4360633 L4.98173,9.9176407 L3.1152186,15.572313 C3.0683188,15.706402 3.1199131,15.854354 3.2324617,15.937583 C3.3497045,16.020803 3.504473,16.020803 3.6217158,15.937583 L8.4990158,12.446755 L13.366941,15.937583 C13.42791,15.979194 13.493559,15.997692 13.559221,15.997692 C13.629564,15.997692 13.695213,15.979194 13.756182,15.937583 C13.873425,15.854354 13.920324,15.706402 13.878119,15.572313 L12.006927,9.9176407 L16.865465,6.4360633 C16.978014,6.3528414 17.029608,6.2048826 16.982708,6.0754223 z"
                                  Fill="{TemplateBinding Foreground}"
                                  Opacity="1"
                                  Stretch="Fill"
                                  Stroke="{x:Null}"
                                  StrokeLineJoin="Round"
                                  UseLayoutRounding="False">
                                <Path.Effect>
                                    <DropShadowEffect BlurRadius="2"
                                                      Direction="-90"
                                                      Opacity="0.75"
                                                      ShadowDepth="1" />
                                </Path.Effect>
                            </Path>
                        </prim:LinearClipper>
                        <ContentPresenter x:Name="Content"
                                          Margin="{TemplateBinding Padding}"
                                          HorizontalAlignment="Left"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          Cursor="{TemplateBinding Cursor}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="toolkit:Rating">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="{x:Null}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Foreground" Value="{StaticResource ColorAccentHighlightBrush}" />
        <Setter Property="ItemContainerStyle" Value="{StaticResource RatingItemStyle}" />
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="toolkit:Rating">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Pressed" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="itemsPresenter"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="0.55"
                                                         d:IsOptimized="True" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ReadOnly">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="itemsPresenter"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="0.75"
                                                         d:IsOptimized="True" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused" />
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}">
                            <ItemsPresenter x:Name="itemsPresenter" />
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        TimePicker (inlcuding TimePopupButtonTemplate)
        ***************************************************************************
    -->

    <ControlTemplate x:Key="TimePopupButtonTemplate" TargetType="ToggleButton">
        <Grid FlowDirection="LeftToRight">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0" />
                        <VisualTransition GeneratedDuration="0:0:0.1" To="MouseOver" />
                        <VisualTransition GeneratedDuration="0:0:0.1" To="Pressed" />
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <DoubleAnimation Duration="0"
                                             Storyboard.TargetName="PressedElement"
                                             Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                             To="0" />
                            <DoubleAnimation Duration="0"
                                             Storyboard.TargetName="MouseOverElement"
                                             Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                             To="1" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Pressed">
                        <Storyboard>
                            <DoubleAnimation Duration="0"
                                             Storyboard.TargetName="NormalElement"
                                             Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                             To="0.25" />
                            <DoubleAnimation Duration="0"
                                             Storyboard.TargetName="PressedElement"
                                             Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                             To="1" />
                            <DoubleAnimation Duration="0"
                                             Storyboard.TargetName="MouseOverElement"
                                             Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                             To="0" />
                            <DoubleAnimation Duration="0"
                                             Storyboard.TargetName="HighlightElement"
                                             Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                             To="0.5" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames BeginTime="0"
                                                           Duration="00:00:00.001"
                                                           Storyboard.TargetName="DisabledVisual"
                                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="0" Value="0.55" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Grid Width="26"
                  Height="24"
                  VerticalAlignment="Top">
                <Border CornerRadius="1">
                    <Border.Background>
                        <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                            <GradientStop Offset="0.65" Color="#FFFFFFFF" />
                            <GradientStop Offset="0.90" Color="#FFF2F2F2" />
                            <GradientStop Offset="1" Color="#FFDADADA" />
                        </LinearGradientBrush>
                    </Border.Background>
                    <Border.Effect>
                        <DropShadowEffect BlurRadius="3"
                                          Opacity="0.5"
                                          ShadowDepth="2"
                                          Color="#55524f" />
                    </Border.Effect>
                </Border>
                <Border x:Name="NormalElement"
                        Height="6"
                        VerticalAlignment="Top"
                        Background="{StaticResource ControlBackgroundNormalGreen}"
                        CornerRadius="1,1,0,0" />
                <Canvas Margin="2,8,2,2">
                    <Ellipse Canvas.Left="4"
                             Width="14"
                             Height="14"
                             Stroke="#606060"
                             StrokeThickness="1">
                        <Ellipse.Fill>
                            <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                <GradientStop Offset="1" Color="#FFD4D4D4" />
                                <GradientStop Color="White" />
                            </LinearGradientBrush>
                        </Ellipse.Fill>
                    </Ellipse>
                    <Rectangle Canvas.Left="10"
                               Canvas.Top="6"
                               Width="5"
                               Height="1"
                               Fill="#606060" />
                    <Rectangle Canvas.Left="10"
                               Canvas.Top="6"
                               Width="1"
                               Height="5"
                               Fill="#606060" />
                </Canvas>
                <Border x:Name="MouseOverElement"
                        Height="6"
                        VerticalAlignment="Top"
                        Background="{StaticResource ControlBackgroundOverGreen}"
                        CornerRadius="2,2,0,0"
                        Opacity="0" />
                <Border x:Name="PressedElement"
                        Height="6"
                        VerticalAlignment="Top"
                        Background="{StaticResource ControlBackgroundPressedGreen}"
                        CornerRadius="2,2,0,0"
                        Opacity="0" />
                <Border x:Name="HighlightElement"
                        Height="6"
                        VerticalAlignment="Top"
                        BorderBrush="{StaticResource HighlightBrushGreen}"
                        BorderThickness="0.5,1,0,0"
                        CornerRadius="1,1,0,0" />
                <Border x:Name="DisabledVisual"
                        Background="{StaticResource DisabledBrush}"
                        CornerRadius="1,1,0,0"
                        Opacity="0" />
            </Grid>
        </Grid>
    </ControlTemplate>

    <Style TargetType="toolkit:TimePicker">
        <Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{StaticResource InputForegroundBrush}" />
        <Setter Property="Height" Value="27" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="MinWidth" Value="125" />
        <Setter Property="Padding" Value="5,4,5,4" />
        <Setter Property="SpinnerStyle" Value="{StaticResource SpinnerStyle}" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="PopupTemplate">
            <Setter.Value>
                <toolkit:TimePickerPopupTemplate>
                    <toolkit:ListTimePickerPopup />
                </toolkit:TimePickerPopupTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="toolkit:TimePicker">
                    <Grid x:Name="RootElement">
                        <Grid.Resources>
                            <ControlTemplate x:Key="TimePopupButtonTemplate" TargetType="ToggleButton">
                                <Grid FlowDirection="LeftToRight">
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualStateGroup.Transitions>
                                                <VisualTransition GeneratedDuration="0" />
                                                <VisualTransition GeneratedDuration="0:0:0.1" To="MouseOver" />
                                                <VisualTransition GeneratedDuration="0:0:0.1" To="Pressed" />
                                            </VisualStateGroup.Transitions>
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="MouseOver">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="PressedElement"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                                     To="0" />
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="MouseOverElement"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                                     To="1" />
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Pressed">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="NormalElement"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                                     To="0.25" />
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="PressedElement"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                                     To="1" />
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="MouseOverElement"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                                     To="0" />
                                                    <DoubleAnimation Duration="0"
                                                                     Storyboard.TargetName="HighlightElement"
                                                                     Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                                     To="0.5" />
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <DoubleAnimationUsingKeyFrames BeginTime="0"
                                                                                   Duration="00:00:00.001"
                                                                                   Storyboard.TargetName="DisabledVisual"
                                                                                   Storyboard.TargetProperty="(UIElement.Opacity)">
                                                        <SplineDoubleKeyFrame KeyTime="0" Value="0.55" />
                                                    </DoubleAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <Grid Width="26"
                                          Height="24"
                                          VerticalAlignment="Top">
                                        <Border CornerRadius="1">
                                            <Border.Background>
                                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                    <GradientStop Offset="0.65" Color="#FFFFFFFF" />
                                                    <GradientStop Offset="0.90" Color="#FFF2F2F2" />
                                                    <GradientStop Offset="1" Color="#FFDADADA" />
                                                </LinearGradientBrush>
                                            </Border.Background>
                                            <Border.Effect>
                                                <DropShadowEffect BlurRadius="3"
                                                                  Opacity="0.5"
                                                                  ShadowDepth="2"
                                                                  Color="#55524f" />
                                            </Border.Effect>
                                        </Border>
                                        <Border x:Name="NormalElement"
                                                Height="6"
                                                VerticalAlignment="Top"
                                                Background="{StaticResource ColorAccentBrush}"
                                                CornerRadius="1,1,0,0" />
                                        <Canvas Margin="2,8,2,2">
                                            <Ellipse Canvas.Left="4"
                                                     Width="14"
                                                     Height="14"
                                                     Stroke="#606060"
                                                     StrokeThickness="1">
                                                <Ellipse.Fill>
                                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                        <GradientStop Offset="1" Color="#FFD4D4D4" />
                                                        <GradientStop Color="White" />
                                                    </LinearGradientBrush>
                                                </Ellipse.Fill>
                                            </Ellipse>
                                            <Rectangle Canvas.Left="10"
                                                       Canvas.Top="6"
                                                       Width="5"
                                                       Height="1"
                                                       Fill="#606060" />
                                            <Rectangle Canvas.Left="10"
                                                       Canvas.Top="6"
                                                       Width="1"
                                                       Height="5"
                                                       Fill="#606060" />
                                        </Canvas>
                                        <Border x:Name="MouseOverElement"
                                                Height="6"
                                                VerticalAlignment="Top"
                                                Background="{StaticResource ColorAccentOverBrush}"
                                                CornerRadius="2,2,0,0"
                                                Opacity="0" />
                                        <Border x:Name="PressedElement"
                                                Height="6"
                                                VerticalAlignment="Top"
                                                Background="{StaticResource ColorAccentSubduedBrush}"
                                                CornerRadius="2,2,0,0"
                                                Opacity="0" />
                                        <Border x:Name="HighlightElement"
                                                Height="6"
                                                VerticalAlignment="Top"
                                                BorderBrush="{StaticResource ColorAccentHighlightBrush}"
                                                BorderThickness="0.5,1,0,0"
                                                CornerRadius="1,1,0,0" />
                                        <Border x:Name="DisabledVisual"
                                                Background="{StaticResource DisabledBrush}"
                                                CornerRadius="1,1,0,0"
                                                Opacity="0" />
                                    </Grid>
                                </Grid>
                            </ControlTemplate>
                        </Grid.Resources>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled" />
                                <VisualState x:Name="Pressed" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused" />
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="PopupStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" To="PopupOpened" />
                                    <VisualTransition GeneratedDuration="0:0:0.2" To="PopupClosed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="PopupOpened">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="PopupRoot"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1.0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="PopupClosed">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="PopupRoot"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <toolkit:TimeUpDown x:Name="TimeUpDown"
                                            Grid.Column="0"
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="{TemplateBinding BorderThickness}"
                                            Culture="{TemplateBinding Culture}"
                                            Format="{TemplateBinding Format}"
                                            Maximum="{TemplateBinding Maximum}"
                                            Minimum="{TemplateBinding Minimum}"
                                            Padding="{TemplateBinding Padding}"
                                            SpinnerStyle="{TemplateBinding SpinnerStyle}"
                                            TimeGlobalizationInfo="{TemplateBinding TimeGlobalizationInfo}"
                                            TimeParsers="{TemplateBinding TimeParsers}" />
                        <ToggleButton x:Name="DropDownToggle"
                                      Grid.Column="1"
                                      Margin="3,0,0,0"
                                      HorizontalAlignment="Center"
                                      VerticalAlignment="Center"
                                      Template="{StaticResource TimePopupButtonTemplate}" />
                        <Popup x:Name="Popup" HorizontalAlignment="Left">
                            <Border x:Name="PopupRoot" BorderThickness="0">
                                <ContentControl x:Name="PopupPlaceHolder"
                                                HorizontalContentAlignment="Stretch"
                                                VerticalContentAlignment="Stretch"
                                                IsTabStop="False" />
                            </Border>
                        </Popup>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        BusyIndicator
        ***************************************************************************
    -->

    <Style TargetType="toolkit:BusyIndicator">
        <Setter Property="Background" Value="#FFF0F0F0" />
        <Setter Property="BorderBrush" Value="{StaticResource DarkBorder}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="BusyContent" Value="Please wait..." />
        <Setter Property="DisplayAfter" Value="00:00:00.1" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="OverlayStyle">
            <Setter.Value>
                <Style TargetType="Rectangle">
                    <Setter Property="Fill" Value="#60000000" />
                    <Setter Property="Opacity" Value="1" />
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="ProgressBarStyle">
            <Setter.Value>
                <Style TargetType="ProgressBar">
                    <Setter Property="Background" Value="{StaticResource ControlBackgroundAltBrush}" />
                    <Setter Property="BorderThickness" Value="0" />
                    <Setter Property="Foreground" Value="{StaticResource ColorAccentBrush}" />
                    <Setter Property="Height" Value="10" />
                    <Setter Property="IsIndeterminate" Value="True" />
                    <Setter Property="IsTabStop" Value="False" />
                    <Setter Property="Margin" Value="0,12,0,0" />
                    <Setter Property="Template" Value="{StaticResource ProgressBarTemplate}" />
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="VerticalAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="toolkit:BusyIndicator">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="VisibilityStates">
                                <VisualState x:Name="Hidden">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.001"
                                                                       Storyboard.TargetName="busycontent"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Collapsed" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.001"
                                                                       Storyboard.TargetName="overlay"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Collapsed" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Visible">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.001"
                                                                       Storyboard.TargetName="busycontent"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.001"
                                                                       Storyboard.TargetName="overlay"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="BusyStatusStates">
                                <VisualState x:Name="Idle">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.001"
                                                                       Storyboard.TargetName="content"
                                                                       Storyboard.TargetProperty="(Control.IsEnabled)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Busy">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.001"
                                                                       Storyboard.TargetName="content"
                                                                       Storyboard.TargetProperty="(Control.IsEnabled)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>False</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentControl x:Name="content"
                                        HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                        Content="{TemplateBinding Content}"
                                        ContentTemplate="{TemplateBinding ContentTemplate}" />
                        <Rectangle x:Name="overlay" Style="{TemplateBinding OverlayStyle}" />
                        <ContentPresenter x:Name="busycontent">
                            <Border MinWidth="160"
                                    MinHeight="60"
                                    Margin="10"
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{StaticResource DarkBorder}"
                                    BorderThickness="1"
                                    CornerRadius="4">
                                <Border.Effect>
                                    <DropShadowEffect BlurRadius="20"
                                                      Opacity="0.4"
                                                      ShadowDepth="20" />
                                </Border.Effect>
                                <Grid Margin="12">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <ContentPresenter VerticalAlignment="Center"
                                                      Content="{TemplateBinding BusyContent}"
                                                      ContentTemplate="{TemplateBinding BusyContentTemplate}" />
                                    <ProgressBar Grid.Row="1" Style="{TemplateBinding ProgressBarStyle}" />
                                </Grid>
                            </Border>
                        </ContentPresenter>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        Accordion (including AccordionItem and a style for AccordionButton)
        ***************************************************************************
    -->

    <Style x:Key="AccordionButtonStyle" TargetType="toolkit:AccordionButton">
        <Setter Property="BorderBrush" Value="{StaticResource DarkBorder}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Background" Value="{StaticResource StaticControlBackground}" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="VerticalAlignment" Value="Stretch" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="IsTabStop" Value="True" />
        <Setter Property="TabNavigation" Value="Once" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="toolkit:AccordionButton">
                    <Grid Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="ExpandDirectionStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="ExpandDown" />
                                <VisualState x:Name="ExpandUp" />
                                <VisualState x:Name="ExpandLeft" />
                                <VisualState x:Name="ExpandRight" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ExpansionStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Collapsed">
                                    <Storyboard>
                                        <DoubleAnimation BeginTime="00:00:00"
                                                         Duration="00:00:00.3"
                                                         Storyboard.TargetName="icon"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
                                                         To="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Expanded">
                                    <Storyboard>
                                        <DoubleAnimation BeginTime="00:00:00"
                                                         Duration="00:00:00.3"
                                                         Storyboard.TargetName="icon"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
                                                         To="90" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="00:00:00" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Checked" />
                                <VisualState x:Name="Unchecked" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                    <VisualTransition From="MouseOver"
                                                      GeneratedDuration="00:00:00.1"
                                                      To="Normal" />
                                    <VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver" />
                                    <VisualTransition GeneratedDuration="00:00:00.1" To="Pressed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="MouseOverElement"
                                                                       Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="PressedElement"
                                                                       Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard />
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused" />
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="background"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                CornerRadius="0">
                            <Grid>
                                <Border x:Name="MouseOverElement"
                                        Height="Auto"
                                        Margin="0"
                                        VerticalAlignment="Stretch"
                                        Background="{StaticResource ControlBackgroundOver}"
                                        CornerRadius="0"
                                        Opacity="0" />
                                <Border x:Name="PressedElement"
                                        Height="Auto"
                                        Margin="0"
                                        VerticalAlignment="Stretch"
                                        Background="{StaticResource ControlBackgroundPressed}"
                                        CornerRadius="0"
                                        Opacity="0" />
                                <StackPanel Orientation="Horizontal">
                                    <Grid x:Name="icon"
                                          Margin="12,0,0,0"
                                          RenderTransformOrigin="0.5,0.5">
                                        <Grid.RenderTransform>
                                            <RotateTransform Angle="0" />
                                        </Grid.RenderTransform>
                                        <Path x:Name="arrow"
                                              Width="5"
                                              Height="8"
                                              Data="M0,0 L1,0.5 0,1Z"
                                              Fill="#404040"
                                              RenderTransformOrigin="0.35,0.5"
                                              Stretch="Fill">
                                            <Path.RenderTransform>
                                                <RotateTransform Angle="0" />
                                            </Path.RenderTransform>
                                        </Path>
                                    </Grid>
                                    <toolkit:LayoutTransformer x:Name="header"
                                                               Margin="8,0"
                                                               HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                               VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                               Content="{TemplateBinding Content}"
                                                               ContentTemplate="{TemplateBinding ContentTemplate}"
                                                               FontFamily="{TemplateBinding FontFamily}"
                                                               FontSize="{TemplateBinding FontSize}"
                                                               FontStretch="{TemplateBinding FontStretch}"
                                                               FontStyle="{TemplateBinding FontStyle}"
                                                               FontWeight="{TemplateBinding FontWeight}"
                                                               Foreground="{TemplateBinding Foreground}" />
                                </StackPanel>
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="toolkit:AccordionItem">
        <Setter Property="AccordionButtonStyle" Value="{StaticResource AccordionButtonStyle}" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="{StaticResource DarkBorder}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="FontWeight" Value="Bold" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="Padding" Value="1,0,1,1" />
        <Setter Property="VerticalAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="toolkit:AccordionItem">
                    <Grid Margin="{TemplateBinding Margin}"
                          HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                          VerticalAlignment="{TemplateBinding VerticalAlignment}"
                          Background="{TemplateBinding Background}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Pressed" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ExpansionStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Collapsed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="ExpandSite"
                                                                       Storyboard.TargetProperty="(ExpandableContentControl.Percentage)">
                                            <SplineDoubleKeyFrame KeySpline="0.2,0,0,1"
                                                                  KeyTime="00:00:00.3"
                                                                  Value="0" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00.3"
                                                                       Duration="00:00:00"
                                                                       Storyboard.TargetName="ExpandSite"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Collapsed" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Expanded">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="ExpandSite"
                                                                       Storyboard.TargetProperty="(ExpandableContentControl.Percentage)">
                                            <SplineDoubleKeyFrame KeySpline="0.2,0,0,1"
                                                                  KeyTime="00:00:00.3"
                                                                  Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="LockedStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Locked">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="ExpanderButton"
                                                                       Storyboard.TargetProperty="IsEnabled">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="False" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unlocked">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="ExpanderButton"
                                                                       Storyboard.TargetProperty="IsEnabled">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="True" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ExpandDirectionStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="ExpandDown">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="layoutTransformer"
                                                         Storyboard.TargetProperty="(LayoutTransformer.LayoutTransform).(RotateTransform.Angle)"
                                                         To="0"
                                                         d:IsOptimized="True" />
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="cd0"
                                                                       Storyboard.TargetProperty="Width">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="rd0"
                                                                       Storyboard.TargetProperty="Height">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ExpandUp">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="layoutTransformer"
                                                         Storyboard.TargetProperty="(LayoutTransformer.LayoutTransform).(RotateTransform.Angle)"
                                                         To="0"
                                                         d:IsOptimized="True" />
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="cd0"
                                                                       Storyboard.TargetProperty="Width">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="rd1"
                                                                       Storyboard.TargetProperty="Height">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" Storyboard.TargetProperty="(Grid.Row)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="0" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="layoutTransformer" Storyboard.TargetProperty="(Grid.Row)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="1" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ExpandLeft">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="layoutTransformer"
                                                         Storyboard.TargetProperty="(LayoutTransformer.LayoutTransform).(RotateTransform.Angle)"
                                                         To="-90"
                                                         d:IsOptimized="True" />
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" Storyboard.TargetProperty="(Grid.Row)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="0" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="layoutTransformer" Storyboard.TargetProperty="(Grid.Column)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="1" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="cd1"
                                                                       Storyboard.TargetProperty="Width">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="rd0"
                                                                       Storyboard.TargetProperty="Height">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ExpandRight">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="layoutTransformer"
                                                         Storyboard.TargetProperty="(LayoutTransformer.LayoutTransform).(RotateTransform.Angle)"
                                                         To="-90"
                                                         d:IsOptimized="True" />
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" Storyboard.TargetProperty="(Grid.Row)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="0" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" Storyboard.TargetProperty="(Grid.Column)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="1" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="cd0"
                                                                       Storyboard.TargetProperty="Width">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="rd0"
                                                                       Storyboard.TargetProperty="Height">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Background"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="0">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition x:Name="cd0" Width="Auto" />
                                    <ColumnDefinition x:Name="cd1" Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition x:Name="rd0" Height="Auto" />
                                    <RowDefinition x:Name="rd1" Height="Auto" />
                                </Grid.RowDefinitions>
                                <toolkit:LayoutTransformer x:Name="layoutTransformer"
                                                           Grid.Row="0"
                                                           Margin="1,0,1,1"
                                                           HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                           VerticalAlignment="{TemplateBinding VerticalAlignment}">
                                    <toolkit:LayoutTransformer.LayoutTransform>
                                        <RotateTransform Angle="0" />
                                    </toolkit:LayoutTransformer.LayoutTransform>
                                    <toolkit:AccordionButton x:Name="ExpanderButton"
                                                             Height="28"
                                                             Margin="0"
                                                             HorizontalContentAlignment="Left"
                                                             VerticalContentAlignment="Center"
                                                             Background="{StaticResource StaticControlBackground}"
                                                             Content="{TemplateBinding Header}"
                                                             ContentTemplate="{TemplateBinding HeaderTemplate}"
                                                             FontFamily="{TemplateBinding FontFamily}"
                                                             FontSize="{TemplateBinding FontSize}"
                                                             FontStretch="{TemplateBinding FontStretch}"
                                                             FontStyle="{TemplateBinding FontStyle}"
                                                             FontWeight="{TemplateBinding FontWeight}"
                                                             Foreground="{TemplateBinding Foreground}"
                                                             IsChecked="{TemplateBinding IsSelected}"
                                                             IsTabStop="True"
                                                             Padding="0"
                                                             Style="{TemplateBinding AccordionButtonStyle}" />
                                </toolkit:LayoutTransformer>
                                <toolkit:ExpandableContentControl x:Name="ExpandSite"
                                                                  Grid.Row="1"
                                                                  Margin="0"
                                                                  HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                                  VerticalAlignment="{TemplateBinding VerticalAlignment}"
                                                                  HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                                  VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                                                  Content="{TemplateBinding Content}"
                                                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                                                  FontFamily="{TemplateBinding FontFamily}"
                                                                  FontSize="{TemplateBinding FontSize}"
                                                                  FontStretch="{TemplateBinding FontStretch}"
                                                                  FontStyle="{TemplateBinding FontStyle}"
                                                                  FontWeight="{TemplateBinding FontWeight}"
                                                                  Foreground="{TemplateBinding Foreground}"
                                                                  IsTabStop="False"
                                                                  Percentage="0"
                                                                  RevealMode="{TemplateBinding ExpandDirection}"
                                                                  Style="{TemplateBinding ExpandableContentControlStyle}" />
                                <Rectangle x:Name="FocusVisualElement"
                                           Margin="1"
                                           IsHitTestVisible="False"
                                           Opacity="0"
                                           RadiusX="1"
                                           RadiusY="1"
                                           Stroke="{StaticResource FocusVisualBrush}"
                                           StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="toolkit:Accordion">
        <Setter Property="Background" Value="{StaticResource DarkBackground}" />
        <Setter Property="BorderBrush" Value="{StaticResource DarkBorder}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Cursor" Value="Arrow" />
        <Setter Property="Foreground" Value="{StaticResource HeaderForegroundBrush}" />
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="TabNavigation" Value="Once" />
        <Setter Property="VerticalAlignment" Value="Top" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel Margin="0,1,0,0" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="toolkit:Accordion">
                    <Grid x:Name="Root" Effect="{StaticResource LightControlShadowEffect}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Pressed" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused" />
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Border"
                                Background="{TemplateBinding Background}"
                                CornerRadius="2.5" />
                        <ScrollViewer Margin="0"
                                      Background="{x:Null}"
                                      BorderBrush="Transparent"
                                      BorderThickness="0"
                                      HorizontalScrollBarVisibility="Disabled"
                                      IsTabStop="False"
                                      Padding="0"
                                      VerticalScrollBarVisibility="Disabled">
                            <ItemsPresenter />
                        </ScrollViewer>
                        <Border x:Name="OuterBorder"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="2.5"
                                IsHitTestVisible="False" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="CustomScrollViewerStyle" TargetType="ScrollViewer">
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="BorderBrush" Value="{x:Null}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Margin" Value="2,1,1,2" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ScrollViewer">
                    <Grid>
                        <Border Margin="0,-1"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Opacity="0.2"
                                Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}">
                            <Border.OpacityMask>
                                <LinearGradientBrush StartPoint="-0.07,0.5" EndPoint="1.07,0.5">
                                    <GradientStop Color="#FF000000" />
                                    <GradientStop Offset="0.5" Color="#7FFFFFFF" />
                                    <GradientStop Offset="1" Color="#FF000000" />
                                </LinearGradientBrush>
                            </Border.OpacityMask>
                        </Border>
                        <Grid Background="{TemplateBinding Background}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <ScrollContentPresenter x:Name="ScrollContentPresenter"
                                                    Margin="{TemplateBinding Padding}"
                                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                                    Cursor="{TemplateBinding Cursor}" />
                            <Rectangle Grid.Row="1"
                                       Grid.Column="1"
                                       Fill="#FFE9EEF4" />
                            <ScrollBar x:Name="VerticalScrollBar"
                                       Grid.Row="0"
                                       Grid.Column="1"
                                       Width="18"
                                       Margin="0,-1"
                                       IsTabStop="False"
                                       Maximum="{TemplateBinding ScrollableHeight}"
                                       Minimum="0"
                                       Orientation="Vertical"
                                       ViewportSize="{TemplateBinding ViewportHeight}"
                                       Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                                       Value="{TemplateBinding VerticalOffset}" />
                            <ScrollBar x:Name="HorizontalScrollBar"
                                       Grid.Row="1"
                                       Grid.Column="0"
                                       Height="18"
                                       Margin="-1,0,-1,-1"
                                       IsTabStop="False"
                                       Maximum="{TemplateBinding ScrollableWidth}"
                                       Minimum="0"
                                       Orientation="Horizontal"
                                       ViewportSize="{TemplateBinding ViewportWidth}"
                                       Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                                       Value="{TemplateBinding HorizontalOffset}" />
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        DataForm
        ***************************************************************************
    -->

    <Style TargetType="toolkit:DataForm">
        <Setter Property="AutoCommit" Value="True" />
        <Setter Property="AutoGenerateFields" Value="True" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="{StaticResource DarkBorder}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="DescriptionViewerPosition" Value="Auto" />
        <Setter Property="Foreground" Value="{StaticResource HeaderForegroundBrush}" />
        <Setter Property="HeaderVisibility" Value="Visible" />
        <Setter Property="LabelPosition" Value="Auto" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="toolkit:DataForm">
                    <Grid toolkit:DataField.IsFieldGroup="True">
                        <Grid.Resources>
                            <Style TargetType="sdk:Label">
                                <Setter Property="Foreground" Value="{StaticResource NormalFontBrush}" />
                                <Setter Property="VerticalAlignment" Value="Center" />
                            </Style>
                            <Style x:Key="CustomScrollViewerStyle" TargetType="ScrollViewer">
                                <Setter Property="HorizontalContentAlignment" Value="Left" />
                                <Setter Property="BorderBrush" Value="{x:Null}" />
                                <Setter Property="BorderThickness" Value="0" />
                                <Setter Property="Margin" Value="2,1,1,2" />
                                <Setter Property="VerticalContentAlignment" Value="Top" />
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="ScrollViewer">
                                            <Grid>
                                                <Border Margin="0,-1"
                                                        BorderBrush="{TemplateBinding BorderBrush}"
                                                        BorderThickness="{TemplateBinding BorderThickness}"
                                                        Opacity="0.2"
                                                        Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}">
                                                    <Border.OpacityMask>
                                                        <LinearGradientBrush StartPoint="-0.07,0.5" EndPoint="1.07,0.5">
                                                            <GradientStop Color="#FF000000" />
                                                            <GradientStop Offset="0.5" Color="#7FFFFFFF" />
                                                            <GradientStop Offset="1" Color="#FF000000" />
                                                        </LinearGradientBrush>
                                                    </Border.OpacityMask>
                                                </Border>
                                                <Grid Background="{TemplateBinding Background}">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="*" />
                                                        <ColumnDefinition Width="Auto" />
                                                    </Grid.ColumnDefinitions>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="*" />
                                                        <RowDefinition Height="Auto" />
                                                    </Grid.RowDefinitions>
                                                    <ScrollContentPresenter x:Name="ScrollContentPresenter"
                                                                            Margin="{TemplateBinding Padding}"
                                                                            ContentTemplate="{TemplateBinding ContentTemplate}"
                                                                            Cursor="{TemplateBinding Cursor}" />
                                                    <Rectangle Grid.Row="1"
                                                               Grid.Column="1"
                                                               Fill="#FFE9EEF4" />
                                                    <ScrollBar x:Name="VerticalScrollBar"
                                                               Grid.Row="0"
                                                               Grid.Column="1"
                                                               Width="18"
                                                               Margin="0,-1"
                                                               IsTabStop="False"
                                                               Maximum="{TemplateBinding ScrollableHeight}"
                                                               Minimum="0"
                                                               Orientation="Vertical"
                                                               ViewportSize="{TemplateBinding ViewportHeight}"
                                                               Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                                                               Value="{TemplateBinding VerticalOffset}" />
                                                    <ScrollBar x:Name="HorizontalScrollBar"
                                                               Grid.Row="1"
                                                               Grid.Column="0"
                                                               Height="18"
                                                               Margin="-1,0,-1,-1"
                                                               IsTabStop="False"
                                                               Maximum="{TemplateBinding ScrollableWidth}"
                                                               Minimum="0"
                                                               Orientation="Horizontal"
                                                               ViewportSize="{TemplateBinding ViewportWidth}"
                                                               Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                                                               Value="{TemplateBinding HorizontalOffset}" />
                                                </Grid>
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </Grid.Resources>
                        <Grid.Effect>
                            <StaticResource ResourceKey="LightControlShadowEffect" />
                        </Grid.Effect>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="DisabledVisual"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.55" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ModeStates">
                                <VisualState x:Name="ReadOnly" />
                                <VisualState x:Name="Empty">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="ContentPresenter"
                                                                       Storyboard.TargetProperty="IsHitTestVisible">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="False" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ContentPresenter"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Edit">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="EditButton"
                                                                       Storyboard.TargetProperty="IsEnabled">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="false" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="CommitButton"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="CancelButton"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="AddNew" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="Invalid" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CommittedStates">
                                <VisualState x:Name="Committed" />
                                <VisualState x:Name="Uncommitted">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ChangeIndicator"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.9" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ScopeStates">
                                <VisualState x:Name="Entity" />
                                <VisualState x:Name="Collection" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="DataFormBorder">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="28" />
                                    <RowDefinition />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <Border Background="{StaticResource StaticControlBackground}"
                                        BorderBrush="{TemplateBinding BorderBrush}"
                                        BorderThickness="1,0,1,0"
                                        CornerRadius="2.5,2.5,0,0" />
                                <Border Grid.Row="1"
                                        Grid.RowSpan="3"
                                        Background="{StaticResource DarkBackground}"
                                        BorderBrush="{TemplateBinding BorderBrush}"
                                        BorderThickness="1,0,1,1"
                                        CornerRadius="0,0,2.5,2.5" />
                                <Grid MinHeight="27" Visibility="{TemplateBinding HeaderVisibility}">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="8" />
                                    </Grid.ColumnDefinitions>
                                    <StackPanel Orientation="Horizontal">
                                        <ContentControl x:Name="HeaderElement"
                                                        Margin="12,0,0,0"
                                                        VerticalAlignment="Center"
                                                        Content="{TemplateBinding Header}"
                                                        ContentTemplate="{TemplateBinding HeaderTemplate}"
                                                        FontWeight="Bold"
                                                        Foreground="{TemplateBinding Foreground}" />
                                        <TextBlock x:Name="ChangeIndicator"
                                                   Margin="3,-2,8,2"
                                                   VerticalAlignment="Center"
                                                   FontWeight="Bold"
                                                   Foreground="{TemplateBinding Foreground}"
                                                   Opacity="0"
                                                   Text="*" />
                                    </StackPanel>
                                    <StackPanel Grid.Column="2"
                                                Margin="8,0"
                                                HorizontalAlignment="Right"
                                                Orientation="Horizontal">
                                        <Button x:Name="FirstItemButton"
                                                Width="24"
                                                HorizontalContentAlignment="Center"
                                                Style="{StaticResource OpacityButton}">
                                            <StackPanel Orientation="Horizontal">
                                                <Rectangle Width="2"
                                                           Height="8"
                                                           Margin="0,0,2,0"
                                                           Fill="#202020" />
                                                <Path Width="5"
                                                      Height="8"
                                                      Data="M0,0.5 L1,1 1,0Z"
                                                      Fill="#202020"
                                                      Stretch="Fill" />
                                            </StackPanel>
                                        </Button>
                                        <Button x:Name="PreviousItemButton"
                                                Width="24"
                                                HorizontalContentAlignment="Center"
                                                Style="{StaticResource OpacityButton}">
                                            <StackPanel Orientation="Horizontal">
                                                <Path Width="5"
                                                      Height="8"
                                                      Data="M0,0.5 L1,1 1,0Z"
                                                      Fill="#202020"
                                                      Stretch="Fill" />
                                            </StackPanel>
                                        </Button>
                                        <Button x:Name="NextItemButton"
                                                Width="24"
                                                HorizontalContentAlignment="Center"
                                                Style="{StaticResource OpacityButton}">
                                            <Path Width="5"
                                                  Height="9"
                                                  Margin="8,5,6,5"
                                                  Data="M0,0 L1,1 L0,2 Z"
                                                  Fill="{TemplateBinding Foreground}"
                                                  Opacity="0.85"
                                                  Stretch="Fill">
                                                <Path.Effect>
                                                    <DropShadowEffect BlurRadius="8"
                                                                      Direction="100"
                                                                      ShadowDepth="0"
                                                                      Color="#FFFFFFFF" />
                                                </Path.Effect>
                                                <Path.OpacityMask>
                                                    <LinearGradientBrush StartPoint="0.4,0" EndPoint="0.6,1">
                                                        <GradientStop Offset="0" Color="#7F000000" />
                                                        <GradientStop Offset="0.25" Color="#BF000000" />
                                                        <GradientStop Offset="1" Color="#FF000000" />
                                                    </LinearGradientBrush>
                                                </Path.OpacityMask>
                                            </Path>
                                        </Button>
                                        <Button x:Name="LastItemButton"
                                                Width="24"
                                                HorizontalContentAlignment="Center"
                                                Style="{StaticResource OpacityButton}">
                                            <StackPanel Orientation="Horizontal">
                                                <Path Width="5"
                                                      Height="8"
                                                      Data="M0,0 L1,0.5 0,1Z"
                                                      Fill="#202020"
                                                      Stretch="Fill" />
                                                <Rectangle Width="2"
                                                           Height="8"
                                                           Margin="2,0,0,0"
                                                           Fill="#202020" />
                                            </StackPanel>
                                        </Button>
                                        <StackPanel x:Name="ButtonSeparator"
                                                    Height="24"
                                                    Margin="6,0"
                                                    Orientation="Horizontal">
                                            <Rectangle Width="1">
                                                <Rectangle.Fill>
                                                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                                                        <GradientStop Offset="0" Color="#0000" />
                                                        <GradientStop Offset="0.3" Color="#3000" />
                                                        <GradientStop Offset="0.7" Color="#3000" />
                                                        <GradientStop Offset="1" Color="#0000" />
                                                    </LinearGradientBrush>
                                                </Rectangle.Fill>
                                            </Rectangle>
                                            <Rectangle Width="1">
                                                <Rectangle.Fill>
                                                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                                                        <GradientStop Offset="0" Color="#0FFF" />
                                                        <GradientStop Offset="0.3" Color="#FFFF" />
                                                        <GradientStop Offset="0.7" Color="#AFFF" />
                                                        <GradientStop Offset="1" Color="#0FFF" />
                                                    </LinearGradientBrush>
                                                </Rectangle.Fill>
                                            </Rectangle>
                                        </StackPanel>
                                        <Button x:Name="EditButton"
                                                Width="24"
                                                HorizontalContentAlignment="Center"
                                                Style="{StaticResource OpacityButton}"
                                                ToolTipService.ToolTip="Edit">
                                            <StackPanel Orientation="Horizontal">
                                                <Path Width="13"
                                                      Height="13"
                                                      Data="M3.34,7.70 L1.94,9.10 L1.36,11.58 L3.85,11.01 L5.25,9.61 z M7.01,2.84 L10.15,5.98 L4.13,12.00 L0,12.95 L0.99,8.86 z M9.95,0 C10.07,0 10.18,0.04 10.27,0.13 L12.82,2.67 C12.99,2.85 12.99,3.13 12.82,3.31 L12.40,3.72 L10.75,5.38 L7.57,2.20 L9.22,0.54 L9.64,0.13 C9.72,0.04 9.84,0 9.95,0 z"
                                                      Fill="#101010"
                                                      Stretch="Fill"
                                                      UseLayoutRounding="True" />
                                            </StackPanel>
                                        </Button>
                                        <Button x:Name="NewItemButton"
                                                Width="24"
                                                HorizontalContentAlignment="Center"
                                                Style="{StaticResource OpacityButton}"
                                                ToolTipService.ToolTip="Add">
                                            <StackPanel Orientation="Horizontal">
                                                <Path Width="12"
                                                      Height="12"
                                                      Data="M0.5,0 L0.5,1 M0,0.5 L1,0.5"
                                                      Stretch="Fill"
                                                      Stroke="#202020"
                                                      StrokeThickness="2" />
                                            </StackPanel>
                                        </Button>
                                        <Button x:Name="DeleteItemButton"
                                                Width="24"
                                                HorizontalContentAlignment="Center"
                                                Style="{StaticResource OpacityButton}"
                                                ToolTipService.ToolTip="Delete">
                                            <StackPanel Orientation="Horizontal">
                                                <Path Width="10"
                                                      Height="10"
                                                      Data="M0,0 L1,1 M0,1 L1,0"
                                                      Stretch="Fill"
                                                      Stroke="#202020"
                                                      StrokeThickness="2" />
                                            </StackPanel>
                                        </Button>
                                    </StackPanel>
                                </Grid>
                                <ScrollViewer Grid.Row="1"
                                              Background="{x:Null}"
                                              IsTabStop="False"
                                              Padding="{TemplateBinding Padding}"
                                              Style="{StaticResource CustomScrollViewerStyle}"
                                              VerticalScrollBarVisibility="Auto">
                                    <ContentPresenter x:Name="ContentPresenter" Margin="12,12,6,12" />
                                </ScrollViewer>
                                <sdk:ValidationSummary x:Name="ValidationSummary"
                                                       Grid.Row="2"
                                                       MaxHeight="100"
                                                       BorderThickness="0" />
                                <StackPanel Grid.Row="3"
                                            HorizontalAlignment="Right"
                                            Orientation="Horizontal">
                                    <Button x:Name="CommitButton"
                                            MinWidth="71"
                                            MinHeight="17"
                                            Margin="12"
                                            HorizontalContentAlignment="Center"
                                            VerticalContentAlignment="Center"
                                            Content="OK"
                                            Visibility="Collapsed" />
                                    <Button x:Name="CancelButton"
                                            MinWidth="71"
                                            MinHeight="17"
                                            Margin="12"
                                            HorizontalContentAlignment="Center"
                                            VerticalContentAlignment="Center"
                                            Content="Cancel"
                                            Visibility="Collapsed" />
                                </StackPanel>
                            </Grid>
                        </Border>
                        <Border x:Name="DisabledVisual"
                                Background="{StaticResource DisabledBrush}"
                                CornerRadius="2.5"
                                IsHitTestVisible="False"
                                Opacity="0" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        Chart
        ***************************************************************************
    -->

    <Style TargetType="toolkit:Chart">
        <Setter Property="BorderBrush" Value="{x:Null}" />
        <Setter Property="Background" Value="White" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Padding" Value="10" />
        <Setter Property="Palette">
            <Setter.Value>
                <toolkit:ResourceDictionaryCollection>
                    <!--  Green  -->
                    <ResourceDictionary>
                        <RadialGradientBrush x:Key="Background" Center="0.075,0.015" GradientOrigin="-0.1,-0.1" RadiusX="1.05" RadiusY="0.9">
                            <GradientStop Color="#B2C60D" />
                            <GradientStop Offset="1" Color="#4C7B00" />
                        </RadialGradientBrush>
                        <Style x:Key="DataPointStyle" TargetType="Control">
                            <Setter Property="Background" Value="{StaticResource Background}" />
                        </Style>
                        <Style x:Key="DataShapeStyle" TargetType="Shape">
                            <Setter Property="Stroke" Value="{StaticResource Background}" />
                            <Setter Property="StrokeThickness" Value="2" />
                            <Setter Property="StrokeMiterLimit" Value="1" />
                            <Setter Property="Fill" Value="{StaticResource Background}" />
                        </Style>
                    </ResourceDictionary>

                    <!--  Blue  -->
                    <ResourceDictionary>
                        <RadialGradientBrush x:Key="Background" Center="0.075,0.015" GradientOrigin="-0.1,-0.1" RadiusX="1.05" RadiusY="0.9">
                            <GradientStop Color="#39B7FF" />
                            <GradientStop Offset="1" Color="#0065AD" />
                        </RadialGradientBrush>
                        <Style x:Key="DataPointStyle" TargetType="Control">
                            <Setter Property="Background" Value="{StaticResource Background}" />
                        </Style>
                        <Style x:Key="DataShapeStyle" TargetType="Shape">
                            <Setter Property="Stroke" Value="{StaticResource Background}" />
                            <Setter Property="StrokeThickness" Value="2" />
                            <Setter Property="StrokeMiterLimit" Value="1" />
                            <Setter Property="Fill" Value="{StaticResource Background}" />
                        </Style>
                    </ResourceDictionary>

                    <!--  Gray  -->
                    <ResourceDictionary>
                        <RadialGradientBrush x:Key="Background" Center="0.075,0.015" GradientOrigin="-0.1,-0.1" RadiusX="1.05" RadiusY="0.9">
                            <GradientStop Color="#85878C" />
                            <GradientStop Offset="1" Color="#33353A" />
                        </RadialGradientBrush>
                        <Style x:Key="DataPointStyle" TargetType="Control">
                            <Setter Property="Background" Value="{StaticResource Background}" />
                        </Style>
                        <Style x:Key="DataShapeStyle" TargetType="Shape">
                            <Setter Property="Stroke" Value="{StaticResource Background}" />
                            <Setter Property="StrokeThickness" Value="2" />
                            <Setter Property="StrokeMiterLimit" Value="1" />
                            <Setter Property="Fill" Value="{StaticResource Background}" />
                        </Style>
                    </ResourceDictionary>

                    <!--  Orange  -->
                    <ResourceDictionary>
                        <RadialGradientBrush x:Key="Background" Center="0.075,0.015" GradientOrigin="-0.1,-0.1" RadiusX="1.05" RadiusY="0.9">
                            <GradientStop Color="#FF9600" />
                            <GradientStop Offset="1" Color="#942B00" />
                        </RadialGradientBrush>
                        <Style x:Key="DataPointStyle" TargetType="Control">
                            <Setter Property="Background" Value="{StaticResource Background}" />
                        </Style>
                        <Style x:Key="DataShapeStyle" TargetType="Shape">
                            <Setter Property="Stroke" Value="{StaticResource Background}" />
                            <Setter Property="StrokeThickness" Value="2" />
                            <Setter Property="StrokeMiterLimit" Value="1" />
                            <Setter Property="Fill" Value="{StaticResource Background}" />
                        </Style>
                    </ResourceDictionary>

                    <!--  Red  -->
                    <ResourceDictionary>
                        <RadialGradientBrush x:Key="Background" Center="0.075,0.015" GradientOrigin="-0.1,-0.1" RadiusX="1.05" RadiusY="0.9">
                            <GradientStop Color="#EE6028" />
                            <GradientStop Offset="1" Color="#8B0000" />
                        </RadialGradientBrush>
                        <Style x:Key="DataPointStyle" TargetType="Control">
                            <Setter Property="Background" Value="{StaticResource Background}" />
                        </Style>
                        <Style x:Key="DataShapeStyle" TargetType="Shape">
                            <Setter Property="Stroke" Value="{StaticResource Background}" />
                            <Setter Property="StrokeThickness" Value="2" />
                            <Setter Property="StrokeMiterLimit" Value="1" />
                            <Setter Property="Fill" Value="{StaticResource Background}" />
                        </Style>
                    </ResourceDictionary>

                    <!--  Yellow  -->
                    <ResourceDictionary>
                        <RadialGradientBrush x:Key="Background" Center="0.075,0.015" GradientOrigin="-0.1,-0.1" RadiusX="1.05" RadiusY="0.9">
                            <GradientStop Color="#FFC12B" />
                            <GradientStop Offset="1" Color="#FF7600" />
                        </RadialGradientBrush>
                        <Style x:Key="DataPointStyle" TargetType="Control">
                            <Setter Property="Background" Value="{StaticResource Background}" />
                        </Style>
                        <Style x:Key="DataShapeStyle" TargetType="Shape">
                            <Setter Property="Stroke" Value="{StaticResource Background}" />
                            <Setter Property="StrokeThickness" Value="2" />
                            <Setter Property="StrokeMiterLimit" Value="1" />
                            <Setter Property="Fill" Value="{StaticResource Background}" />
                        </Style>
                    </ResourceDictionary>

                    <!--  Pink  -->
                    <ResourceDictionary>
                        <RadialGradientBrush x:Key="Background" Center="0.075,0.015" GradientOrigin="-0.1,-0.1" RadiusX="1.05" RadiusY="0.9">
                            <GradientStop Color="#E94780" />
                            <GradientStop Offset="1" Color="#A4023B" />
                        </RadialGradientBrush>
                        <Style x:Key="DataPointStyle" TargetType="Control">
                            <Setter Property="Background" Value="{StaticResource Background}" />
                        </Style>
                        <Style x:Key="DataShapeStyle" TargetType="Shape">
                            <Setter Property="Stroke" Value="{StaticResource Background}" />
                            <Setter Property="StrokeThickness" Value="2" />
                            <Setter Property="StrokeMiterLimit" Value="1" />
                            <Setter Property="Fill" Value="{StaticResource Background}" />
                        </Style>
                    </ResourceDictionary>

                    <!--  Royal Blue  -->
                    <ResourceDictionary>
                        <RadialGradientBrush x:Key="Background" Center="0.075,0.015" GradientOrigin="-0.1,-0.1" RadiusX="1.05" RadiusY="0.9">
                            <GradientStop Color="#4C7AC0" />
                            <GradientStop Offset="1" Color="#07357B" />
                        </RadialGradientBrush>
                        <Style x:Key="DataPointStyle" TargetType="Control">
                            <Setter Property="Background" Value="{StaticResource Background}" />
                        </Style>
                        <Style x:Key="DataShapeStyle" TargetType="Shape">
                            <Setter Property="Stroke" Value="{StaticResource Background}" />
                            <Setter Property="StrokeThickness" Value="2" />
                            <Setter Property="StrokeMiterLimit" Value="1" />
                            <Setter Property="Fill" Value="{StaticResource Background}" />
                        </Style>
                    </ResourceDictionary>

                    <!--  Cyan  -->
                    <ResourceDictionary>
                        <RadialGradientBrush x:Key="Background" Center="0.075,0.015" GradientOrigin="-0.1,-0.1" RadiusX="1.05" RadiusY="0.9">
                            <GradientStop Color="#40ABCA" />
                            <GradientStop Offset="1" Color="#1E505F" />
                        </RadialGradientBrush>
                        <Style x:Key="DataPointStyle" TargetType="Control">
                            <Setter Property="Background" Value="{StaticResource Background}" />
                        </Style>
                        <Style x:Key="DataShapeStyle" TargetType="Shape">
                            <Setter Property="Stroke" Value="{StaticResource Background}" />
                            <Setter Property="StrokeThickness" Value="2" />
                            <Setter Property="StrokeMiterLimit" Value="1" />
                            <Setter Property="Fill" Value="{StaticResource Background}" />
                        </Style>
                    </ResourceDictionary>

                    <!--  Purple  -->
                    <ResourceDictionary>
                        <RadialGradientBrush x:Key="Background" Center="0.075,0.015" GradientOrigin="-0.1,-0.1" RadiusX="1.05" RadiusY="0.9">
                            <GradientStop Color="#9A5AA6" />
                            <GradientStop Offset="1" Color="#482A4E" />
                        </RadialGradientBrush>
                        <Style x:Key="DataPointStyle" TargetType="Control">
                            <Setter Property="Background" Value="{StaticResource Background}" />
                        </Style>
                        <Style x:Key="DataShapeStyle" TargetType="Shape">
                            <Setter Property="Stroke" Value="{StaticResource Background}" />
                            <Setter Property="StrokeThickness" Value="2" />
                            <Setter Property="StrokeMiterLimit" Value="1" />
                            <Setter Property="Fill" Value="{StaticResource Background}" />
                        </Style>
                    </ResourceDictionary>

                    <!--  Brown  -->
                    <ResourceDictionary>
                        <RadialGradientBrush x:Key="Background" Center="0.075,0.015" GradientOrigin="-0.1,-0.1" RadiusX="1.05" RadiusY="0.9">
                            <GradientStop Color="#775931" />
                            <GradientStop Offset="1" Color="#210000" />
                        </RadialGradientBrush>
                        <Style x:Key="DataPointStyle" TargetType="Control">
                            <Setter Property="Background" Value="{StaticResource Background}" />
                        </Style>
                        <Style x:Key="DataShapeStyle" TargetType="Shape">
                            <Setter Property="Stroke" Value="{StaticResource Background}" />
                            <Setter Property="StrokeThickness" Value="2" />
                            <Setter Property="StrokeMiterLimit" Value="1" />
                            <Setter Property="Fill" Value="{StaticResource Background}" />
                        </Style>
                    </ResourceDictionary>
                </toolkit:ResourceDictionaryCollection>
            </Setter.Value>
        </Setter>
        <Setter Property="TitleStyle">
            <Setter.Value>
                <Style TargetType="toolkit:Title">
                    <Setter Property="FontSize" Value="24" />
                    <Setter Property="HorizontalAlignment" Value="Left" />
                    <Setter Property="Margin" Value="0,0,0,25" />
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="LegendStyle">
            <Setter.Value>
                <Style TargetType="toolkit:Legend">
                    <Setter Property="Margin" Value="10,0,0,0" />
                    <Setter Property="VerticalAlignment" Value="Top" />
                    <Setter Property="BorderBrush" Value="#808080" />
                    <Setter Property="Background" Value="#F0F0F0" />
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="ChartAreaStyle">
            <Setter.Value>
                <Style TargetType="Panel">
                    <Setter Property="MinWidth" Value="100" />
                    <Setter Property="MinHeight" Value="75" />
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="PlotAreaStyle">
            <Setter.Value>
                <Style TargetType="Grid">
                    <Setter Property="Background" Value="Transparent" />
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="toolkit:Chart">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="4"
                            Effect="{StaticResource LightControlShadowEffect}"
                            Padding="{TemplateBinding Padding}">
                        <Grid Margin="{TemplateBinding Padding}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <toolkit:Title Content="{TemplateBinding Title}" Style="{TemplateBinding TitleStyle}" />
                            <Grid Grid.Row="1">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <dvp:EdgePanel x:Name="ChartArea" Style="{TemplateBinding ChartAreaStyle}">
                                    <Border BorderBrush="#D0D0D0"
                                            BorderThickness="1"
                                            Canvas.ZIndex="10" />
                                    <Grid Canvas.ZIndex="-1" Style="{TemplateBinding PlotAreaStyle}" />
                                </dvp:EdgePanel>
                                <toolkit:Legend x:Name="Legend"
                                                Grid.Column="1"
                                                Header="{TemplateBinding LegendTitle}"
                                                Style="{TemplateBinding LegendStyle}">
                                    <toolkit:Legend.Effect>
                                        <DropShadowEffect BlurRadius="4"
                                                          Direction="-90"
                                                          Opacity="0.25"
                                                          ShadowDepth="2" />
                                    </toolkit:Legend.Effect>
                                </toolkit:Legend>
                            </Grid>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        MenuItem
        ***************************************************************************
    -->

    <Style TargetType="toolkit:MenuItem">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="Foreground" Value="{StaticResource InputForegroundBrush}" />
        <Setter Property="Padding" Value="8,0" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="toolkit:MenuItem">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="Presenter"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.5" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="contentControl"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="0.5"
                                                         d:IsOptimized="True" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Unfocused" />
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusedElement"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="1"
                                                         d:IsOptimized="True" />
                                        <ColorAnimation Duration="0"
                                                        Storyboard.TargetName="Presenter"
                                                        Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)"
                                                        To="White"
                                                        d:IsOptimized="True" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid MinHeight="28" VerticalAlignment="Center">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" MinWidth="30" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Border x:Name="FocusedElement"
                                    Grid.ColumnSpan="2"
                                    Background="{StaticResource InputSelectionBrush}"
                                    Opacity="0" />
                            <ContentPresenter x:Name="contentControl"
                                              Margin="1"
                                              VerticalAlignment="Center"
                                              Content="{TemplateBinding Icon}" />
                            <ContentControl x:Name="Presenter"
                                            Grid.Column="1"
                                            Margin="{TemplateBinding Padding}"
                                            VerticalAlignment="Center"
                                            Content="{TemplateBinding Header}"
                                            ContentTemplate="{TemplateBinding HeaderTemplate}"
                                            Foreground="{TemplateBinding Foreground}" />
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        ContextMenu
        ***************************************************************************
    -->

    <Style TargetType="toolkit:ContextMenu">
        <Setter Property="Background" Value="#FFE0E0E0" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="BorderBrush" Value="{StaticResource DarkBorder}" />
        <Setter Property="Padding" Value="0,6" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="toolkit:ContextMenu">
                    <Grid>
                        <Grid.Effect>
                            <DropShadowEffect BlurRadius="20"
                                              Opacity="0.4"
                                              ShadowDepth="20" />
                        </Grid.Effect>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition MaxWidth="30" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Border Margin="1,1,0,1"
                                Background="#FFD0D0D2"
                                BorderBrush="#FFB6B6BA"
                                BorderThickness="0,0,1,0"
                                CornerRadius="2.5,0,0,2.5" />
                        <Border Grid.Column="1"
                                Margin="0,1,1,1"
                                Background="{TemplateBinding Background}"
                                BorderBrush="#FFF0F0F0"
                                BorderThickness="1,0,0,0"
                                CornerRadius="0,2.5,2.5,0" />
                        <ItemsPresenter Grid.ColumnSpan="2" Margin="{TemplateBinding Padding}" />
                        <Border Grid.ColumnSpan="2"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="2.5"
                                IsHitTestVisible="False" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>